package com.wwwarehouse.usercenter.fragment.permissiondistribute;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wwwarehouse.common.activity.base.BaseFragment;
import com.wwwarehouse.usercenter.R;
import com.wwwarehouse.usercenter.adapter.AuserRvAdapter;
import com.wwwarehouse.usercenter.bean.authoritydistribute.AuserRvBean;

import java.util.ArrayList;
import java.util.List;


/**
 * @author : mundane
 * @time : 2017/9/27 19:57
 * @description :
 * @file : AuthorityAuserListFragment.java
 */

public class AuthorityAuserListFragment extends BaseFragment {

	private RecyclerView mRecyclerView;
	private static final String KEY_LIST = "key_list";
	private List<AuserRvBean> mDataList;
	private AuserRvAdapter mRvAdapter;

	public static AuthorityAuserListFragment newInstance(ArrayList<AuserRvBean> list) {
		AuthorityAuserListFragment fragment = new AuthorityAuserListFragment();
		Bundle bundle = new Bundle();
		bundle.putParcelableArrayList(KEY_LIST, list);
		fragment.setArguments(bundle);
		return fragment;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Bundle bundle = getArguments();
		if (bundle != null) {
			mDataList = bundle.getParcelableArrayList(KEY_LIST);
		}

	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.fragment_list_detail_distribute_authority, container, false);
		return view;
	}

	@Override
	public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
		// findViewById
		mRecyclerView = $(R.id.rv);
		if (!mDataList.isEmpty()) {
			mRvAdapter = new AuserRvAdapter(mDataList);
			mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
			mRecyclerView.setAdapter(mRvAdapter);
		}
	}

	@Override
	public void setTitle() {

	}

	@Override
	public void requestDatas() {

	}
}
